package com.shqcjd.sinopecdemomobile.ui.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.shqcjd.sinopecdemomobile.R;
import com.shqcjd.sinopecdemomobile.model.pojo.MsgBean;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 系统消息
 * Created by sy on 2019/3/21.
 */

public class MessageListAdapter extends BaseQuickAdapter<MsgBean.ListBean,MessageListAdapter.ViewHolder> {

    public MessageListAdapter() {
        super(R.layout.item_message);
    }

    @Override
    protected void convert(MessageListAdapter.ViewHolder helper, MsgBean.ListBean item) {
        helper.tv_title.setText(item.title);
        helper.tv_content.setText(item.body);
        helper.tv_time.setText(item.createTime);

        if (item.status == 1) {//	0:未读、1：已读
            helper.iv_red_dot.setVisibility(View.GONE);
        } else {
            helper.iv_red_dot.setVisibility(View.VISIBLE);
        }
    }

    class ViewHolder extends BaseViewHolder {
        @BindView(R.id.tv_title)
        TextView tv_title;
        @BindView(R.id.tv_content)
        TextView tv_content;
        @BindView(R.id.tv_time)
        TextView tv_time;
        @BindView(R.id.iv_red_dot)
        ImageView iv_red_dot;

        public ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }
}